import QtQuick 2.3
import QtQuick.Controls 1.2
import QmlObjectTest 1.0

ApplicationWindow {
    visible: true
    width: 640
    height: 480
    title: qsTr("Hello World")

    menuBar: MenuBar {
        Menu {
            title: qsTr("File")
            MenuItem {
                text: qsTr("&Open")
                onTriggered: console.log("Open action triggered");
            }
            MenuItem {
                text: qsTr("Exit")
                onTriggered: Qt.quit();
            }
        }
    }

    QmlObjectTest{
        id: qmlObjectTest
    }

    Label {
        text: qsTr("Hello World")
        anchors.centerIn: parent
    }
    //qml console分类与c++的QDebug对应关系
    //console.debug,log —— QtDebugMsg
    //console.warn —— QtWarningMsg
    //console.error —— QtCriticalMsg
    //console.info —— QtInfoMsg
    //console.? —— QtFatalMsg

    Row{
        Column{
            spacing: 5
            Button{
                text: "qml"
            }
            Button{
                text: "debug"
                onClicked: console.debug("[your qml log level is *"+text+"*]")
            }
            Button{
                text: "warning"
                onClicked: console.warn("[your qml log level is *"+text+"*]")
            }
            Button{
                text: "cirtical"
                onClicked: console.error("[your qml log level is *"+text+"*]")
            }
            Button{
                text: "fatal"
                onClicked: console.error("[your qml log level is *"+text+"*]")
            }
            Button{
                text: "info"
                onClicked: console.info("[your qml log level is *"+text+"*]")
            }
        }

        Column{
            spacing: 5
            Button{
                text: "c++"
            }
            Button{
                text: "debug"
                onClicked: qmlObjectTest.printLog(QmlObjectTest.QtDebugMsgTest, "")
            }
            Button{
                text: "warning"
                onClicked: qmlObjectTest.printLog(QmlObjectTest.QtWarningMsgTest, "")
            }
            Button{
                text: "cirtical"
                onClicked: qmlObjectTest.printLog(QmlObjectTest.QtCriticalMsgTest, "")
            }
            Button{
                text: "fatal"
                onClicked: qmlObjectTest.printLog(QmlObjectTest.QtFatalMsgTest, "")
            }
            Button{
                text: "info"
                onClicked: qmlObjectTest.printLog(QmlObjectTest.QtInfoMsgTest, "")
            }
        }
    }
}

